<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Stict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
strict.dtd">
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page  isELIgnored="false" %>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE html>
<html lang="en">
<head>
	<title>中铁十四局集团第三工程有限公司微信管理平台</title>	
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<meta name="decorator" content="login"/>
</head>
<body>
<div class="login-wrapper">
  <div class="login-container">
    <div class="login-title"></div>
    <div class="login-content">
      <div class="login-form">
      	<form onsubmit="return load();" method="post" id="loginForm" name="loginForm" >
        <div class="form-title">登录</div>
        <div class="login-form-group">
          <label for="username">账号：</label>
          <input type="text"  id="userName"  name="userName" placeholder="请输入账号" required>
        </div>

        <div class="login-form-group">
          <label for="password">密码：</label>
          <input type="password" id="password" name="password" placeholder="请输入密码" required>
        </div>

        <div class="login-form-group">
          <input class="login-btn" type="submit" name="submit" value="登录">
        </div>
        </form>
      </div>
    </div>
    <div class="login-footer">
      中铁十四局集团第三工程有限公司 Copyright @ 2015 All Rights Reserved
    </div>
  </div>
</div>

<script type="text/javascript">
    	$("input[name='userName']").focus();
		function load(){
			if($("input[name='userName']").val()==""||$("input[name='password']").val()==""){
        		$(".warnning").text("用户名或密码不可为空");
        		return false;
			}
			//alert($("input[name='userName']").val()+","+$("input[name='password']").val());
 			$("input[name='submit']").addClass("btn_grey");
 			$("input[name='submit']").val("登 录 中");
			$("input[name='submit']").attr("disabled",true);
			$.ajax({
		        type: "POST",
		        dataType: "json",
		        url: '${ctx}/sys/login',
		        data: {"userName": $("input[name='userName']").val(),"password":$("input[name='password']").val(),tm:new Date().getTime()},
		        success: function (data) {
		 			$("input[name='submit']").removeClass("btn_grey");
		        	$("input[name='submit']").attr("disabled",false);
		 			$("input[name='submit']").val("登 录");
		        	if(data.status!='0'){
		        		$(".warnning").text(data.error);
		        		return false;
		        	}
		        	window.location.href = '${ctx}'+ data.data; 
		        	return false;
	        	},
		        error: function(data) {
		 			$("input[name='submit']").removeClass("btn_grey");
		        	$("input[name='submit']").attr("disabled",false);
		 			$("input[name='submit']").val("登 录");
	        		$(".warnning").text(msg.error);
	        		alert(msg.error);
		        }
		    });
        	return false;
		}
	</script>
</body>
</html>
